#include <iostream>
using std::cout;
#include <algorithm>
#include <vector>
#include <iterator>
#include <stdexcept>

int main()
{
	const int L=6;
	int a[L]={1,2,3,4,5,6};
	std::vector<int>int1(a,a+L);
	std::ostream_iterator<int>out(cout," ");
	
	cout<<"Vectorul int1 contine: ";
	std::copy(int1.begin(),int1.end(),out);
	std::cout<<"Primul: "<<int1.front();
	std::cout<<"\nUltimul: "<<int1.back();
	int1[0]=6;
	int1.at(5)=10;
	cout<<"\n";
	int1.insert(int1.begin()+1,10);
	std::copy(int1.begin(),int1.end(),out);
	try{
		int1.at(100)=44;
	}
	catch(std::out_of_range)
	{
		cout<<"Eroare! ";
	}
	cout<<"\n";
	try{
		int1.at(100)=44;
	}
	catch(std::out_of_range &e)
	{
		cout<<"Eroare! "<<e.what();
	}
	int1.erase(int1.begin());
	cout<<"\n";
	std::copy(int1.begin(),int1.end(),out);
	int1.erase(int1.begin(),int1.end());
	int1.insert(int1.begin(),2);
	cout<<"Dupa ce am sters elemente vectorul "<<(int1.empty()?"este":"nu este")<<" gol";
	std::copy(int1.begin(),int1.end(),out);

	
	return 0;
}

